package com.airport.ticket.common;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	
	private static SimpleDateFormat dateFormat = null;
	
	public static String getCurrentTime() {
		if(dateFormat==null) {
			dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		}
		return dateFormat.format(new Date());
	}
	
	public static Date parseToDate(String dateStr) {
		if(dateFormat==null) {
			dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		}
		Date result = null;
		try {
			result = dateFormat.parse(dateStr);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return result;
	}

}
